//获取应用实例
var app = getApp();
const request = require('../../../utils/request');
Page({
    //初始化数据
    data: {
      token: '',
      userInfo:''
    },
    //获取页面数据
    onLoad: function(){
      var that = this
      //页面标题
      wx.setNavigationBarTitle({
          title: '钱包'
      })
      //动态数据
      wx.getStorage({
        key: 'sessionId',
        success: function(res) {
              //调用接口请求数据
              request.HttpRequst(true, 'user/userMessage', false, '', { "token": res.data }, "post", false, res =>{ 
                console.log(res)
                  if (res.code==200){//获取成功
                    that.setData({
                      userInfo: res.data[0]
                    })
                    console.log(that.data.moneyInfoUrl)
                   }else{//其他情况跳到登录页
                    wx.showModal({
                      title: '提示',
                      content: res.info,
                    })
                    //console.log(res)
                   }
              })
        }
      })
    },

    recharge() {
        wx.navigateTo({
            url: 'balance/recharge/recharge'
        })
    },
    toPassWord(e) {
        wx.navigateTo({
            url: 'balance/setPassWord/setPassWord?type='+e.currentTarget.dataset.type
        })
    },
    toDetail() {
        wx.navigateTo({
            url: 'balance/detail/detail'
        })
    }

})